﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;

namespace Sistema_de_Taller.SDT_DAL.Utilities
{
    public class ReplacementUsed_DAL
    {
       
        public void ReplacementUsedInsert(Common_Files.Definitions.ReplacementUsed ReplacementUsed)
        {
            SqlConnection Connection = Common_Files.Connection.OpenConecction();
            SqlCommand Command = new SqlCommand(@"insert into ReplacementUsed (Replacement_ID, ReplacementUsed_Quantity, WorkOrder_ID) 
                                                                values ('" + ReplacementUsed.Replacement_ID + "', '" + ReplacementUsed.ReplacementUsed_Quantity + "', '" + ReplacementUsed.WorkOrderID + "')", Connection);
            Common_Files.Connection.CloseConecction(Connection, Command);
        }

        public DataSet ReplacementUsedLoadID(UInt32 WorkOrderID)
        {
            SqlConnection Connection = Common_Files.Connection.OpenConecction();
            SqlDataAdapter Command = new SqlDataAdapter(@"Select Replacement_ID, ReplacementUsed_Quantity, WorkOrder_ID from ReplacementUsed where WorkOrder_ID = '" + WorkOrderID + "'", Connection);
            DataSet DataSet = new DataSet();
            Command.Fill(DataSet);
            return (DataSet);
        }
    }
}